﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="RssSourcesLinks.ascx.cs" Inherits="admin_webparts_Plug_ins_RssNews_RssSourcesLinks" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="NTTHAO.CommonWeb" %>
<%@ Import Namespace="NTTHAO.Web.BL.Rss" %>

<%
    string bUrl = "?type=" + Request.QueryString["type"] + "&name=" + Request.QueryString["name"] + "&item=" + Request.QueryString["item"] + (Request.QueryString["site"] == null ? "" : "&site=" + Request.QueryString["site"]);
    bool isAdmin = Context.User.Identity.Name.Equals("admin", StringComparison.OrdinalIgnoreCase);
%>
<%if (_Site != null) { %>
<script type="text/javascript">
    function confirmDelete() {
        var msg = '<%=LanguageUtility.GetLanguageText("CONFIRM_DELETE", Session).Replace("<br />", "\\n")%>';
        return confirm(msg);
    }
</script>
<div class="tip" style="overflow: hidden;">
    <div style="clear: left; float: left; overflow: hidden;">
	    <a target="_blank" href="<%=_Site.SiteDomain %>"><h2 style="padding-top: 2px;"><%=_Site.SiteName %></h2></a>
    </div>
    <div style="float: right; width: 450px; text-align: right;">
        <span id="spLinkAddContent" class="yui-button yui-link-button yuibtn yuibtn-icon btnaddfeed"><span class="first-child"><a href="<%=bUrl %>&action=addlink" tabindex="0" id="spLinkAddContent-button">Thêm liên kết RSS</a></span></span>
        <span id="spLinkEdit" class="yui-button yui-link-button yuibtn yuibtn-icon btnedit"><span class="first-child"><a href="<%=bUrl %>&action=editsite" tabindex="0" id="spLinkEdit-button">Sửa</a></span></span>
        <span id="spLinkDelete" class="yui-button yui-link-button yuibtn yuibtn-icon btndelete"><span class="first-child"><a href="<%=bUrl %>&action=removesite" onclick="javascript: return confirmDelete();" tabindex="0" id="spLinkDelete-button">Xóa</a></span></span>
    </div>
</div>
<table border="1" cellpadding="0" cellspacing="0" class="grid" id="tbGrid">
    <tr>
        <th width="42px">#</th>
        <th>Tên</th>
        <th>Liên kết</th>
        <th>Lần cập nhật cuối</th>
        <th>Kích hoạt</th>
        <th width="90px">Chức năng</th>
    </tr><%
    if (_List != null)
    {
        for (int i = 0; i < _List.Rows.Count; i++)
        {
            DataRow row = _List.Rows[i];
            string id = row[RssLink.ID__COLUMN_NAME].ToString();
            string name = row[RssLink.NAME__COLUMN_NAME].ToString();
            string url = row[RssLink.RSSURL__COLUMN_NAME].ToString();
            string lastSync = ((DateTime)row[RssLink.LASTSYNC__COLUMN_NAME]).ToString("yyyy/MM/dd HH:mm");
            lastSync = (lastSync.Equals(DateTime.MaxValue.ToString("yyyy/MM/dd HH:mm"), StringComparison.OrdinalIgnoreCase) ? "-" : lastSync);
            bool activated = (bool)row[RssLink.ACTIVATED__COLUMN_NAME];
%>
    <tr class="<%=(i%2==1?"even":"odd") %>">
        <td align="center"><%=i + 1 %></td>
        <td align="left"><b><%=name %></b></td>
        <td align="left"><a href="<%=url%>" target="_blank"><%=url%></a></td>
        <td align="center"><%=lastSync%></td>
        <td align="center"><%=(activated ? "<img src=\"resources/images/active_l.png\"" : "<img src=\"resources/images/inactive_l.png\"")%></td>
        <td align="left">
            <ul class="icon" style="width: 56px;">
                <li><a title="<%=LanguageUtility.GetLanguageText("EDIT", Session)%>" href="<%=bUrl %>&action=editlink&id=<%=id %>" class="icon editbn">&nbsp</a></li>
                <li><a title="<%=LanguageUtility.GetLanguageText("DELETE", Session)%>" href="<%=bUrl %>&action=removelink&id=<%=id %>" class="icon deletebn" onclick="javascript: return confirmDelete();">&nbsp;</a></li>
            </ul>
        </td>
    </tr>
<%
        }
    }    
%>
</table>
<%} %>